# import matplotlib.pyplot as plt
# import pandas as pd
# df = pd.read_excel('学生各学期成绩表.xlsx')
# plt.figure(figsize=(10,8))
# x = df['序号']
# y = df['语文']
# plt.rcParams['font.sans-serif'] = 'SimHei'
# plt.title('学生各学期成绩分析')
# plt.xlabel('学期')
# plt.ylabel('成绩')
# for a,b in zip(df['序号'],df['语文']):
#     plt.text(a,b,'%.lf' % b,ha='center')
# plt.grid(axis='y')
# plt.xticks(range(11),df['学期'],rotation=15)
# plt.plot(x,y)
# plt.legend(('语文',))
# plt.show()
#
# import matplotlib.pyplot as plt
# import pandas as pd
# df = pd.read_excel('学生各学期成绩表.xlsx')
# plt.rcParams['figure.figsize'] = (10,6)
# plt.rcParams['font.sans-serif'] = 'SimHei'
# plt.rcParams['xtick.direction'] = 'in'
# plt.rcParams['ytick.direction'] = 'in'
# plt.title('学生各学期成绩分析')
# plt.xlabel('学期')
# plt.ylabel('成绩')
# plt.xticks(rotation=15)
# plt.grid()
# x = df['学期']
# plt.plot(x,df['语文'],'--^')
# plt.plot(x,df['数学'],'-.o')
# plt.plot(x,df['英语'],'r:d')
# plt.legend(['语文','数学','英语'])
# plt.show()

import matplotlib.pyplot as plt
import pandas as pd
from cycler import cycler
import numpy as np
df = pd.read_excel('城镇单位就业人员年平均工资.xlsx',sheet_name='按行业',index_col=0)
df.drop('城镇单位',inplace=True)
df.drop(columns=['2001年','2002年'],inplace=True)
df.sort_index(axis=1,inplace=True)
plt.rcParams['figure.figsize'] = (12,8)
plt.rcParams['font.sans-serif'] = 'SimHei'
colors = []
for i in range(len(df)):
    r = np.random.rand()
    g = np.random.rand()
    b = np.random.rand()
    colors.append((r,g,b))
plt.rcParams['axes.prop_cycle'] = cycler(color=colors)
plt.title('2003-2020年按行业分城镇单位就业人员年平均工资折线图')
plt.xlabel('年份')
plt.ylabel('平均工资/元')
x = df.columns
for index in df.index:
    plt.plot(x,df.loc[index])
plt.legend(df.index)
plt.show()